<template>
  <div id="test6">
    <el-row :gutter="20">
      <el-col :span="8">
        <el-card>
          <div slot="header" class="clearfix">
            <span>组织架构</span>
            <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
          </div>
          <div>
            <el-input placeholder="请输入内容" suffix-icon="el-icon-search" v-model="input1"></el-input>
            <div class="block">
              <el-tree
                :data="data"
                show-checkbox
                node-key="id"
                default-expand-all
                :expand-on-click-node="false"
                :render-content="renderContent"
              ></el-tree>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="16">
        <el-card>
          <span>考勤记录</span>
          <el-row style="margin-top: 20px">
            <el-col :span="4">
              <el-button type="primary">考勤报表导出</el-button>
            </el-col>
          </el-row>
          <el-row style="margin-top: 20px">
            <el-col :span="2.5" style="margin-top:10px; margin-left:10px">
              <span>考勤状态:</span>
            </el-col>
            <el-col :span="6">
              <el-select v-model="value" placeholder="请选择">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
            <el-col :span="2.5" style="margin-top:10px; margin-left:10px">
              <span>考勤时间:</span>
            </el-col>
            <el-col :span="8">
              <div class="block">
                <el-date-picker
                  v-model="value1"
                  type="datetimerange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                ></el-date-picker>
              </div>
            </el-col>
          </el-row>
          <el-row style="margin-top: 20px">
            <el-col :span="2.5" style="margin-top:10px; margin-left:10px">
              <span>学生姓名:</span>
            </el-col>
            <el-col :span="6">
              <el-input v-model="input" placeholder="请输入学生姓名"></el-input>
            </el-col>
            <el-col :span="2.5" style="margin-top:10px; margin-left:10px">
              <span>设备IMEI:</span>
            </el-col>
            <el-col :span="6">
              <el-input v-model="input" placeholder="请输入设备IMEI"></el-input>
            </el-col>
            <el-col :span="1" style="margin-top:10px; margin-left:10px">
              <span>RFID:</span>
            </el-col>
            <el-col :span="5">
              <el-input v-model="input" placeholder="请输入RFID"></el-input>
            </el-col>
          </el-row>
          <el-row :gutter="20" style="margin-top: 20px">
            <el-col :span="4">
              <el-button type="primary" icon="el-icon-search">搜索</el-button>
            </el-col>
            <el-col :span="4">
              <el-button icon="el-icon-delete">清空</el-button>
            </el-col>
          </el-row>
          <el-row :gutter="20" style="margin-top: 20px"></el-row>
          <el-table :data="tableData" border style="width: 100%; margin-top: 20px">
            <el-table-column prop="no" label="序号"></el-table-column>
            <el-table-column prop="name" label="姓名"></el-table-column>
            <el-table-column prop="class" label="班级"></el-table-column>
            <el-table-column prop="school" label="学校名称"></el-table-column>
            <el-table-column prop="imeirfid" label="IMEI/RFID"></el-table-column>
            <el-table-column prop="stuTel" label="学生手机号"></el-table-column>
            <el-table-column prop="kind" label="考勤类型"></el-table-column>
            <el-table-column prop="state" label="考勤状态"></el-table-column>
            <el-table-column prop="time" label="考勤时间"></el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
<script>
let id = 1000;
export default {
  name: "test6",
  //组件创建
  created() {},
  mounted() {},
  data() {
    const data = [
      {
        id: 1,
        label: "一级 1",
        children: [
          {
            id: 4,
            label: "二级 1-1",
            children: [
              {
                id: 9,
                label: "三级 1-1-1",
              },
              {
                id: 10,
                label: "三级 1-1-2",
              },
            ],
          },
        ],
      },
    ];
    return {
      data: JSON.parse(JSON.stringify(data)),
      input_username: "",
      input_id: "",
      options:[{
          value: "选项1",
          label: "全部",
        },
      ],
      value: "全部",
      value1: [new Date(2022, 0, 11, 0, 0, 0), new Date(2022, 0, 11, 23, 59, 59)],
      tableData: [
        {
          no: "001",
          name: "陈小狗",
          class: "三年（2）班",
          school: "一所小学",
          imeirfid: "12345",
          stuTel: "13500000000",
          kind: "进校考勤",
          state: "已考勤",
          time: "2020-12-01",
        },
        {
          no: "001",
          name: "陈小狗",
          class: "三年（2）班",
          school: "一所小学",
          imeirfid: "12345",
          stuTel: "13500000000",
          kind: "进校考勤",
          state: "已考勤",
          time: "2020-12-01",
        },
        {
          no: "001",
          name: "陈小狗",
          class: "三年（2）班",
          school: "一所小学",
          imeirfid: "12345",
          stuTel: "13500000000",
          kind: "进校考勤",
          state: "已考勤",
          time: "2020-12-01",
        },
        {
          no: "001",
          name: "陈小狗",
          class: "三年（2）班",
          school: "一所小学",
          imeirfid: "12345",
          stuTel: "13500000000",
          kind: "进校考勤",
          state: "已考勤",
          time: "2020-12-01",
        },
      ],
    };
  },
  methods: {
    append(data) {
      const newChild = { id: id++, label: "testtest", children: [] };
      if (!data.children) {
        this.$set(data, "children", []);
      }
      data.children.push(newChild);
    },

    remove(node, data) {
      const parent = node.parent;
      const children = parent.data.children || parent.data;
      const index = children.findIndex((d) => d.id === data.id);
      children.splice(index, 1);
    },
  },
};
</script>
<style lang="less" scoped>
.custom-tree-node {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding-right: 8px;
}
</style>
